﻿@model IEnumerable<dynamic>
<div style="float: right">
    <input type="button" class="btn" value="Add Group" onclick=" addGroup(); " />
</div>
<div class="clear">
</div>
@(Html.Telerik()
      .Grid(Model)
      .Name("GroupGrid")
      .Columns(c =>
                   {
                       c.Bound(typeof (int),
                               "Id")
                        .Title("#")
                        .Width(50);
                       c.Bound(typeof (string),
                               "Name")
                        .Title("Name");
                       c.Bound(typeof (DateTime),
                               "FromDate")
                        .Title("From Date").Format("{0:dd/MM/yyyy}");
                       c.Bound(typeof(DateTime),
                               "ToDate")
                        .Title("To Date").Format("{0:dd/MM/yyyy}");
                       c.Template(v => v.Id)
                        .ClientTemplate("<a class=\"t-button t-button-icon t-grid-edit\" href=\"javascript:editGroup(<#=Id#>);\"><span class=\"t-icon t-edit\"></span></a>" +
                                        "<a class=\"t-button t-button-icon t-grid-delete\" href=\"javascript:deleteGroup(<#=Id#>);\"><span class=\"t-icon t-delete\"></span></a>")
                        .Width(80);
                   })
      .Sortable(c => c.Enabled(true))
      .Filterable()
      .DataKeys(c => c.Add("Id"))
      .Pageable(c
                =>
                    {
                        c.Enabled(true);
                        c.PageSize(25);
                    })
      .DataBinding(c => c.Ajax()
                         .Select("GetGroupList",
                                 "Article",
                                 new
                                     {
                                             id = ViewBag.Id
                                     })))